<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 创建下划线的几种方法及拓展 -->
    <style>
        p{
            font-size: 24px;
            font-style: italic;
        }
        /* 下划线方法一 */
        p:nth-child(1){
            text-decoration: underline;
        }
        /* 下划线方法二 */
        p:nth-child(2){
            display: inline-block;
            border-bottom: 2px solid black;
            line-height: .9;
        }
        /* 下划线方法三 */
        p:nth-child(3){
            background: linear-gradient(gray, gray) no-repeat;
            background-size: 100% 2px;
            background-position: 0 1.15em;
            /* 遇到 y、g 等不直接穿过 */
            text-shadow: .05em 0 white, -.05em 0 white;
        }



    </style>
</head>
<body>
    <p>The only way to get rid of a temptation is to yield to it.</p>
    <p>The only way to get rid of a temptation is to yield to it.</p>
    <p>The only way to get rid of a temptation is to yield to it.</p>
</body>
</html>